<!DOCTYPE html>
<html>
<head>
    <title>素材表</title>
		<#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
			<#if shiro.hasPermission("sys:material:save")>
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
			</#if>
			<#if shiro.hasPermission("sys:material:update")>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
			</#if>
			<#if shiro.hasPermission("sys:material:delete")>
            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
			</#if>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal" style="width:100%;">
                <div class="form-group">
                    <div class="form-group" id="form">
                        <div class="col-sm-2 control-label">图片上传</div>
                        <div class="col-sm-10">
                            <div style="display:flex;flex-wrap:wrap;">
                                <!-- <img style="width:180px;height:140px;" id="imageId"/>-->
                                <span v-for="(item,index) in urlList" :key="index">
                                    <!-- imgurl里放的是前面的http地址，在data里定义 -->
                                    <img style="width:180px;heightty:140px;margin-right:10px;" :src="item"/>
                                </span>
                            </div>
                            <div id="uploadForm">
                                <input id="file" type="file" name="file" @change="fileUpload"/>
                                <input id="upload" type="button" class="btn btn-primary" @click="fileUpload" value="上传"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">标题</div>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" v-model="material.title" placeholder=""/>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">描述</div>
                    <div class="col-sm-10">
                        <textarea  cols="60" rows="5" class="body-textarea" v-model="material.content" ></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2 control-label">排序</div>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" v-model="material.sort" placeholder="排序"/>
                    </div>
                </div>
				<div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" id="btnSaveOrUpdate" data-loading-text="保存中..." @click="saveOrUpdate" value="确定"/>
                <input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>

<script src="${request.contextPath}/statics/js/modules/sys/material.js?_${.now?long}"></script>
</body>
</html>